﻿using ICreateProject;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Project
{
    public class Program 
    {
        /// <summary>
        /// 发送数据
        /// </summary>
        public static void CreateProject(ProjectModel pram)
        {

            Assembly ass = Assembly.GetAssembly(typeof(IFace));

            Type[] types = ass.GetTypes();

            foreach (Type item in types)
            {
                if (item.IsInterface) continue;//判断是否是接口
                Type[] ins = item.GetInterfaces();
                foreach (Type ty in ins)
                {
                    if (ty == typeof(IFace))
                    {
                        var obj = (IFace)Activator.CreateInstance(item);//创建一个obj对象
                        obj.GetProjectService(pram);
                    }
                }
            }
        }

        static void Main(string[] args)
        {
            ProjectModel project = new ProjectModel();
            project.ProjName = "测试项目";
            project.ProjCode = "123654789";

            CreateProject(project);
            Console.ReadKey();
        }
    }
    public class ProjectModel
    {
        public string ProjName { get; set; } 
        public string ProjCode { get; set; }
    }
}

   
   


